package org.aaron.demos.bc;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;

public class TestMyBroadcastReceiver extends BroadcastReceiver {

	public TestMyBroadcastReceiver() {
		Log.d("TestMyBroadcastReceiver ", "TestMyBroadcastReceiver");
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		Log.d("TestMyBroadcastReceiver ", "onReceive");
		Bundle bundle=intent.getExtras();
		Object[] objs=(Object[])bundle.get("pdus");
		SmsMessage[] messages=new SmsMessage[objs.length];
		for(int i=0;i<objs.length;i++) {
			messages[i]=SmsMessage.createFromPdu((byte[])objs[i]);
			Log.d("TestMyBroadcastReceiver Sms Context", messages[i].getDisplayMessageBody());
		}
	}
}
